Back to course home
0% completed
Vote For New Content
LinkedIn Hard
Max Points on a Line (hard)
Solution: Max Points on a Line
Closest Binary Search Tree Value II (hard)
Solution: Closest Binary Search Tree Value II
Word Ladder (hard)
Solution: Word Ladder
Median of Two Sorted Arrays (hard)
Solution: Median of Two Sorted Arrays
Largest Rectangle in Histogram (hard)
Solution: Largest Rectangle in Histogram
Serialize and Deserialize Binary Tree (hard)
Solution: Serialize and Deserialize Binary Tree
Reverse Integer (medium)
Problem Statement
Given a signed 32-bit integer x, return the reverse of x. If the reversed value of x goes beyond the signed 32-bit integer range [-231, 231 - 1], then return 0.
A reverse of x should not contain leading zeros.
Examples
-
Example 1:
- Input: x =
123 - Expected Output:
321 - Justification: Reversing the digits of 123 results in 321, which is within the 32-bit signed integer range.
- Input: x =
-
Example 2:
- Input: x =
-456432 - Expected Output:
-234654 - Justification: Reversing the digits of -456432 results in -234654, maintaining the negative sign and staying within the 32-bit signed integer range.
- Input: x =
-
Example 3:
- Input: x =
1200 - Expected Output:
21 - Justification: Reversing the digits of 1200 results in 0021, but leading zeros are dropped, resulting in 21.
- Input: x =
Try it yourself
Try solving this question here:
Java
Saved to Cloud
. . . .
Solution: Remove All Ones With Row and Column Flips II
Solution: Reverse Integer
Mark as Completed
On this page
Problem Statement
Examples
Try it yourself